package 抽象数据类型;

public class Node implements Comparable{
    //数据域
    public Comparable data;//指向数据
    //指针域
    public Node next;//指向下一个节点

    public Node(Comparable value) {
        this.data = value;

    }

    public Node() {

    }

    public Comparable getData() {
        return data;
    }

    public void setData(Comparable data) {
        this.data = data;
    }

    //显示数据方法
    public void display() {
        System.out.print(data + " ");
    }

    @Override
    public int compareTo(Object o) {
        return this.compareTo(o);
    }

    public static void print(Node node) {
        if (node != null) {
            System.out.print(node.data + "\t");
            node = node.next;
        }
    }

}
